/*
 * $Id: JMapPane.java 52 2010-01-11 01:42:30Z aaron.day $
 */
package org.crazydays.gameplan.map.swing;


import java.awt.Component;
import java.awt.Dimension;
import java.awt.Rectangle;

import javax.swing.JLayeredPane;
import javax.swing.Scrollable;

import org.crazydays.gameplan.swing.ScrollableImpl;

/**
 * JMapPane
 */
public class JMapPane
    extends JLayeredPane
    implements Scrollable
{
    /** serial version uid */
    public final static long serialVersionUID =
        "$Id: JMapPane.java 52 2010-01-11 01:42:30Z aaron.day $".hashCode();

    /** scrollable implementation */
    protected Scrollable scrollable = new ScrollableImpl(this);

    /**
     * Get scrollable.
     * 
     * @return Scrollable
     */
    public Scrollable getScrollable()
    {
        return scrollable;
    }

    /**
     * Get preferred scrollable viewport size.
     * 
     * @return Dimension
     * @see javax.swing.Scrollable#getPreferredScrollableViewportSize()
     * @see Component#getPreferredSize()
     */
    public Dimension getPreferredScrollableViewportSize()
    {
        return getScrollable().getPreferredScrollableViewportSize();
    }

    /**
     * Get scrollable block increment.
     * 
     * @param visibleRect Visisble rectangle
     * @param orientation Orientation
     * @param direction Direction
     * @return Increment
     * @see javax.swing.Scrollable#getScrollableBlockIncrement(Rectangle,int,int)
     */
    public int getScrollableBlockIncrement(Rectangle visibleRect,
        int orientation, int direction)
    {
        return getScrollable().getScrollableBlockIncrement(visibleRect,
            orientation, direction);
    }

    /**
     * Get scrollable tracks viewport height.
     * 
     * @return Tracks
     * @see javax.swing.Scrollable#getScrollableTracksViewportHeight()
     */
    public boolean getScrollableTracksViewportHeight()
    {
        return getScrollable().getScrollableTracksViewportHeight();
    }

    /**
     * Get scrollable tracks viewport width.
     * 
     * @return Tracks
     * @see javax.swing.Scrollable#getScrollableTracksViewportWidth()
     */
    public boolean getScrollableTracksViewportWidth()
    {
        return getScrollable().getScrollableTracksViewportWidth();
    }

    /**
     * Get scrollable unit increment.
     * 
     * @param visibleRect Visible rectangle
     * @param orientation Orientation
     * @param direction Direction
     * @return Increment
     * @see javax.swing.Scrollable#getScrollableUnitIncrement(Rectangle,int,int)
     */
    public int getScrollableUnitIncrement(Rectangle visibleRect,
        int orientation, int direction)
    {
        return getScrollable().getScrollableUnitIncrement(visibleRect,
            orientation, direction);
    }

}
